﻿
CREATE PROCEDURE [dbo].[proc_Employee_GetList_DIdAll]
	(
		@DepartmentId int
	)
AS
Begin
	Declare @bmbh_T  varchar(30)
	Select @bmbh_T=bmbh From department Where id=@DepartmentId

	Select
	e.Id,
	e.UserName,
	e.EName,
	Isnull((Select DName From Department Where Id=e.DepartmentId),'...') As DepartmentName,
	Isnull((Select PostName From Post Where Id=e.PostId),'...') As PostName
	From Employee e
-- Where e.DepartmentId in (select id from Department Where Id=@DepartmentId Or ParentId=@DepartmentId) and e.State<>5
	Where DepartmentId in(Select Id From department Where Left(bmbh,Len(@bmbh_T))=@bmbh_T) And e.State<>5
	Order By DepartmentId,UserName
End


